$("#leftselect").dblclick(function(){//绑定双击事件
    //获取全部的选项，删除并追加给对方
    $("option:selected",this).appendTo("#rightselect");//追加给对方
});


$("#rightselect").dblclick(function(){//绑定双击事件
    //获取全部的选项，删除并追加给对方
    $("option:selected",this).appendTo("#leftselect");//追加给对方
});


$('#btn_addserver').click(function(){
   $("option:selected",$("#leftselect")).appendTo("#rightselect");
});


$("#btn_transfer").click(function(){
  var selectHost  = $("#rightselect").val();
  var remote_command = $("#remote_command").val();
  var ajax = $.ajax({
		type: "POST",
		url: '/server_exec_commands',
		data: {"selectHost": selectHost+"","remote_command":remote_command},
		timeout: 15000,
		success: function (data)
        {
           $("#resultspan").html(data.data);
        },
		dataType: 'json',
		async: true,
	});
});


function commandSearch(val){
   var aa = val;
   $("#seleccommand").val($(aa).attr("data-content"));
   $('#myModal').modal('hide')
}

$('#myModal').on('hidden.bs.modal', function (e) {
   $("#remote_command").val($("#seleccommand").val());
})